#ifndef CLIENTPLAYERMANAGER_H
#define CLIENTPLAYERMANAGER_H

#include "Singleton.h"
#include "ClientInfo.h"
#include "Vec3.h"
#include "MutexLocker.h"

#include <vector>
#include <map>

class ClientPlayerManager : public Uncopyable
{
	ClientPlayerManager();
	friend class Singleton<ClientPlayerManager>;
public:
	void Update();
	void Draw();

	void AddClient(int id, ClientInfo info);

	void SetClientPos(int id, const Vec3fNet& pos);
	Vec3fNet GetClientPos(int id) const;
	void SetClientVel(int id, const Vec3fNet& vel);
	Vec3fNet GetClientVel(int id) const;

	void RemoveClient(int id);

private:
	std::map<int, ClientInfo> m_clients;
	std::vector<int> m_removedList;
	unsigned int m_sendPosTimer;
	Mutex m_mutex;
};

typedef Singleton<ClientPlayerManager> TheCPManager;

#endif //CLIENTPLAYERMANAGER_H